<template>
<div class="swiper_container">
<div class="swiper" >
    <el-carousel trigger="click" height="285px">
      <el-carousel-item v-for="(item, index) in banners" :key="index">
        <img :src="item.imageUrl" alt=""  width="100%" height="285px"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</div>
  
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      banners: {},
      backgroundImg:'',
    };
  },
  created() {
    axios.get("http://127.0.0.1:3000/banner").then((res) => {
      this.banners = res.data.banners;
      this.backgroundImg = this.banners[0].imageUrl;
    });
  },
};
</script>
<style scoped>
.swiper_container{
    width: 100%;
    height: 285px;
}
.swiper {
  width: 100%;
  height: 285px;
  margin: 0 auto;
}
</style>